users = [
    {
        'id': 1,
        'uid': 913,
        'rid': 912
    },
    {
        'id': 2,
        'uid': 912,
        'rid': 911
    },
    {
        'id': 3,
        'uid': 911,
        'rid': 910
    },
    {
        'id': 4,
        'uid': 914,
        'rid': 913
    }
]

user_finances = [
    {
        'id': 1,
        'uid': 911,
        'balance': 100
    },
    {
        'id': 1,
        'uid': 912,
        'balance': 100
    },
    {
        'id': 1,
        'uid': 913,
        'balance': 100
    },
    {
        'id': 4,
        'uid': 914,
        'balance': 0
    },
]


def search(uid):
    for user in users:
        if user['uid'] == uid:
            return user
    pass


def cal_balance(uid,rec_money):
    for user in user_finances:
        if uid == user['uid']:
            return user['balance'] + rec_money
    pass


newUid = 914
recs = []
money = int(input('please set money::'))
profits = [12, 6, 3]
for index in range(3):
    uid = newUid
    if not index == 0:
        uid = recs[index - 1]['rid']
    rec = search(uid)
    if rec:
        recs.append(rec)
        rec_money = (money * profits[index]) / 100
    print(rec['rid'],cal_balance(rec['rid'],rec_money))